From: kaf24@firebug.cl.cam.ac.uk Date: Tue, 17 Jan 2006 12:25:30 +0000 (+0100) Subject: Sync against scheduler tail on other CPUs when context X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16541^2~20 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=d7d7c642c2bd5bdb936303d686e701e10b434f75;p=xen.git Sync against scheduler tail on other CPUs when context switching to a new VCPU. Otherwise we cannot pull the VCPU's state off the other CPU. Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index b38147211a..25746ab4f1 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -738,8 +738,12 @@ void context_switch(struct vcpu *prev, struct vcpu *next) ASSERT(cpus_weight(dirty_mask) <= 1); if ( unlikely(!cpu_isset(cpu, dirty_mask) && !cpus_empty(dirty_mask)) ) { + /* Make sure the next VCPU is not in a scheduling tail. */ + while ( test_bit(_VCPUF_running, &next->vcpu_flags) ) + cpu_relax(); /* Other cpus call __sync_lazy_execstate from flush ipi handler. */ - flush_tlb_mask(dirty_mask); + if ( !cpus_empty(next->vcpu_dirty_cpumask) ) + flush_tlb_mask(next->vcpu_dirty_cpumask); } local_irq_disable();